package javat.util;

import static com.google.common.collect.Sets.newHashSet;

import java.util.HashSet;
import java.util.Set;

import net.ftng.commons.lang.Monitor;
import net.ftng.commons.lang.utils.MonitorUtils;

import org.junit.Test;

public class SetTest {

    @Test
    public void capacity() {

        int dataSize = 300000;
        Monitor monitor = MonitorUtils.getMonitor(this.getClass().getSimpleName(), "capacity");
        Set<Long> set1 = newHashSet();
        monitor.start();
        for (long i = 0; i < 10000; i++) {

            set1.add(i);
        }
        monitor.stopAndprintResult("Not given capacity");

        Set<Long> set2 = new HashSet<Long>(dataSize);
        monitor.start();
        for (long i = 0; i < 10000; i++) {

            set2.add(i);
        }
        monitor.stopAndprintResult("Given %d capacity", dataSize);
    }
}
